package com.gel.shortLink.controller;

import com.gel.shortLink.convention.result.Result;
import com.gel.shortLink.convention.result.Results;
import com.gel.shortLink.service.UrlTitleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class UrlTitleController {

    private final UrlTitleService urlTitleService;
    /*获取网站标题*/

    @GetMapping("/api/short-link/title/{Url}")
    public Result<String> getTitleByUrl(@PathVariable("Url") String Url){
        return Results.success(urlTitleService.getTitleByUrl(Url));
    }
}
